Skip to content

Implement "Get Single Question" API Endpoint#9

Open
tsegeredab wants to merge 4 commits intotadcodegithub:mainfrom
tsegeredab:single-question
Open

Implement "Get Single Question" API Endpoint#9
tsegeredab wants to merge 4 commits intotadcodegithub:mainfrom
tsegeredab:single-question

Conversation

@tsegeredab
Copy link
Copy Markdown
Collaborator

📝 Summary

  • Implemented the "Get Single Question" API endpoint to fetch a question by its ID.
  • Added the necessary route in questionRoutes.js.
  • Created the controller function getSingleQuestion in questionController.js.
  • Ensured error handling for invalid or missing question IDs.

🔧 Changes Made

  • Added a new route: GET /api/questions/:question_id
  • Connected the route to the getSingleQuestion controller.
  • Implemented database logic to fetch a question from MongoDB. *(this has to be corrected)
  • Handled edge cases such as "Question Not Found" and server errors.

🔬 How to Test

  1. Start the server: npm run dev
  2. Use Postman or a browser to test:

@tsegeredab
Copy link
Copy Markdown
Collaborator Author

I have resolved most of the merge conflicts but left one conflict (controller/questionController.js ) for the main branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant